package com.gzu.emr.service.impl;

import com.gzu.emr.dto.Patient;
import com.gzu.emr.mapper.PatientMapper;
import com.gzu.emr.service.PatientService;
import jakarta.annotation.Resource;
import org.apache.ibatis.annotations.Result;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientServiceImpl implements PatientService {

    @Resource
    private PatientMapper patientMapper;

    @Override
    public List<Patient> listPatientByStatus(Integer status) {
        if(status > 1 || status < 0) {
            //error
        }
        List<Patient> patients = patientMapper.selectPatientByStatus(status);
        return patients;
    }

    @Override
    public List<Patient> searchPatientByName(String name) {
        name = "%" + name + "%";
        List<Patient> patients = patientMapper.selectPatientByName(name);

        return patients;
    }
}
